﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Weazel.Willows.Model
{
	public class TransitionSet
	{
		protected List<Transition> transitions;
		public List<Transition> Transitions
		{
			get { return transitions; }
			set { transitions = value; }
		}

		protected WaitTransition waitTransition;
		public WaitTransition WaitTransition
		{
			get { return waitTransition; }
			set { waitTransition = value; }
		}

		protected string sourceStateName;
		public string SourceStateName
		{
			get { return sourceStateName; }
			set { sourceStateName = value; }
		}

		public bool HasWaitTransition
		{
			get { return this.waitTransition != null; }
		}

		public TransitionSet()
		{
			this.transitions = new List<Transition>();
		}

		public void WriteTo(System.CodeDom.Compiler.IndentedTextWriter textWriter)
		{
			textWriter.WriteLine("Source state: " + sourceStateName);
			textWriter.Indent++;
			foreach (Transition transition in transitions)
				textWriter.WriteLine("target: {0}", transition.TargetStateName);			
			textWriter.Indent--;
		}
	}
}
